package com.alan.shiro.api.token;

import lombok.Getter;
import lombok.Setter;
import org.apache.shiro.authc.AuthenticationToken;

/**
 * @Auther: Alan liu
 * @Date: 2018/12/13 10:31
 * @Description: StatelessToken
 */
public class StatelessToken implements AuthenticationToken {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    @Getter
    private Long userId;

    @Getter
    @Setter
    private String token;

    public StatelessToken(Long userId, String token){
        this.userId = userId;
        this.token = token;
    }

    /**
     * 身份
     * @return
     */
    @Override
    public Object getPrincipal() {
        return userId;
    }

    /**
     * 证明/凭证
     * @return
     */
    @Override
    public Object getCredentials() {
        return token;
    }

}
